package com.crealth.mapper;

import java.sql.Timestamp;
import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.crealth.Result.DayKpiSignedResult;
import com.crealth.Result.FollowupConsumerResult;
import com.crealth.model.ConsumerProductModel;

public abstract interface ConsumerProductMapper {
	
	public abstract Integer insertConsumerProduct(ConsumerProductModel product);
	
	public abstract List<ConsumerProductModel> selectAllConsumerProduct();
	
	public abstract List<ConsumerProductModel> selectConsumerProductByCompanyID(
    		@Param("companyID")int companyID);
	
	public abstract List<ConsumerProductModel> selectConsumerProductByMortgagerName(
			@Param("mortgagerName")String mortgagerName);
	
	public abstract List<ConsumerProductModel> selectConsumerProductByUserID(
			@Param("userID")int userID);
	
	public abstract List<ConsumerProductModel> selectConsumerProductByUserIDs(
			@Param("userIDs")String userIDs);
	
	public abstract ConsumerProductModel selectMainProductByContractID(
			@Param("contractID")int contractID);
	
	
	//  查询某天  签约的
	public abstract List<ConsumerProductModel> selectConsumerProductBySignedTime(
			@Param("searchDay")String searchDay);	
	//  查询某天  放款
	public abstract List<ConsumerProductModel> selectConsumerProductByExtendLoanTime(
			@Param("searchDay")String searchDay);
	
	//  查询某天  签约的
	public abstract List<DayKpiSignedResult> selectConsumerSignedResultBySignedTime(
			@Param("searchDay")String searchDay);	
	//  查询某天  放款
	public abstract List<DayKpiSignedResult> selectConsumerResultByExtendLoanTime(
			@Param("searchDay")String searchDay);
	
	//  startTm 开始的  签约
	public abstract List<ConsumerProductModel> selectSignedConsumerProduct(
			@Param("startTm")Timestamp startTm, 
			@Param("endTm")Timestamp endTm);	
	//  startTm 放款日期
	public abstract List<ConsumerProductModel> selectExtendLoanConsumerProduct(
			@Param("startTm")Timestamp startTm, 
			@Param("endTm")Timestamp endTm);
	// startTm  收佣日期
	public abstract List<ConsumerProductModel> selectBrokerageConsumerProduct(
			@Param("startTm")Timestamp startTm, 
			@Param("endTm")Timestamp endTm);
	//  签约和放款
	public abstract List<ConsumerProductModel> selectSignedExtendLoanProduct(
			@Param("startTm")Timestamp startTm, 
			@Param("endTm")Timestamp endTm);
	
	public abstract List<ConsumerProductModel> selectProductByContractID(
			@Param("contractID")int contractID);
	
	public abstract ConsumerProductModel selectConsumerProductByID(
			@Param("id")int id);
	
	public abstract List<Integer> selectContractIDsByMortgagerName(
			@Param("mortgagerName")String mortgagerName);
	
	public abstract Integer selectContractProductCnt(
			@Param("contractID")int contractID);
	
	public abstract Integer updateConsumerProductByID(ConsumerProductModel product);
    
	public abstract Integer updateConsumerProductAccept(
			@Param("id")int id,
			@Param("setAccept")int setAccept);
	
	public abstract Integer updateCustomerServiceMemoByID(
			@Param("id")int id,
			@Param("csMemo")String csMemo);
	
	public abstract Integer updateEarnestStatusByID(
			@Param("id")int id,
			@Param("setStatus")int setStatus);
	
	public abstract Integer updateProductBrokerage(ConsumerProductModel product);
	
	public abstract Integer updateUserIDByID(
			@Param("id")int id,
			@Param("setUserID")int setUserID);
	
	public abstract Integer updateProductNoByID(
			@Param("id")int id,
			@Param("productNo")String productNo);
	
	public abstract Integer deleteProductByID(
			@Param("productID")int productID);
	
	
	//  查询  所有 待审批的数量
	public abstract List<FollowupConsumerResult> selectWaitApprovalNum();
	
	public abstract ConsumerProductModel selectConsumerProductByProductNo(
			@Param("productNo")String productNo);
	
	
	
}
